package com.rabbit.eap.framework.common.exception;

import com.rabbit.eap.framework.common.api.ApiCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @projectName eap
 * @packageName com.rabbit.eap.framework.common.exception
 * @className EapException
 * @author： rabbit
 * @version： 1.0
 * @since： 2020/4/9 13:48
 * <p>Description: EapException
 * 自定义异常
 * </p>

 */
@Data
@EqualsAndHashCode(callSuper = true)
public class EapException extends RuntimeException {
    private Integer errorCode;
    private String message;

    public EapException() {
        super();
    }

    public EapException(String message) {
        super(message);
        this.message = message;
    }

    public EapException(Integer errorCode, String message) {
        super(message);
        this.errorCode = errorCode;
        this.message = message;
    }

    public EapException(ApiCode apiCode) {
        super(apiCode.getMessage());
        this.errorCode = apiCode.getCode();
        this.message = apiCode.getMessage();
    }

    public EapException(String message, Throwable cause) {
        super(message, cause);
    }

    public EapException(Throwable cause) {
        super(cause);
    }
}
